require("extendClass")

testClass = {}

extensionClass = {}
function extensionClass:ExtendedPrint()
    print("hello a extended print")
end

extensionClass.testValue = 20


-- 由于搜索的复杂性，多重继承的效率比起单继承
-- 要低。一个简单的改善性能的方法是将继承方法拷贝到子类。

baseClass = {}
function baseClass:BasePrint()
    print("hello this is base print")
end


setmetatable(testClass, {__index = baseClass})
testClass:BasePrint()
--testClass:ExtendedPrint()

--setmetatable(testClass, {__index = extensionClass})


extendClass(testClass, extensionClass)
testClass:BasePrint()
testClass:ExtendedPrint()
print(extensionClass)
print(testClass)
extendClass(testClass, extensionClass)
testClass.testValue = 50

testClass2 = {}
extendClass(testClass2, extensionClass)
print(testClass.testValue)
print(testClass2.testValue)